// ********************************************************************************************
// Este archivo fuente es propiedad de Feria de Remates S.R.L. de C.V. Prohibida su copia o uso
// sin autorización explícita.
// This source file is propietary to Feria de Remates S.R.L. de C.V. May not be used or copied
// without explicit authorization.
// ********************************************************************************************/
package com.feriaderemates.dao.listing;

import com.feriaderemates.domain.message.Message;
import java.util.List;

/**
 *
 * @author Oscar García
 */
public interface MessagingDaoInterface {

    /**
     * Adds a Message sent to a user. The fields to add are:
     * senderUsername, receiverUsername, message and subject
     *
     * @param message the Message to add
     * @return the Message's identifier (auto-generated db key)
     */
    public long addMessage(Message message);

    /**
     * Gets a Message by its id. Fields needed are arguments in the method
     * Message.createMessageToShow. A join is needed to get the user's username
     *
     * @param messageId the messageId
     * @return the Message
     */
    public Message getMessageById(long messageId);

    /**
     * Gets received messages for a given username.
     * Fields needed are arguments in the method Message.createMessageToShow. 
     *
     * @param receiverUsername the user's username
     * @return the list of messages
     */
    public List<Message> getReceivedMessages(String receiverUsername);

    /**
     * Gets sent messages for a given user id.
     * Fields needed are arguments in the method Message.createMessageToShow.
     *
     * @param senderUsername the sender user's name
     * @return the list of messages
     */
    public List<Message> getSentMessages(String senderUsername);
}
